package com.i2863.receiptinterface.service.impl;

import com.i2863.receiptinterface.entity.Receipt;
import com.i2863.receiptinterface.mapper.ReceiptMapper;
import com.i2863.receiptinterface.service.ReceiptService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ReceiptServiceImpl implements ReceiptService {

    @Resource
    private ReceiptMapper receiptMapper;

    @Override
    public Receipt findOne(Integer Id) {
        return receiptMapper.selectByPrimaryKey(Id);
    }

    @Override
    public List<Receipt> findAll() {
        return receiptMapper.selectAll();
    }

    @Override
    public void update(Receipt receipt) {
        receiptMapper.updateByPrimaryKey(receipt);
    }

    @Override
    public void delete(Integer Id) {
        receiptMapper.deleteByPrimaryKey(Id);
    }

    @Override
    public Receipt findByCodeAndCodeNum(String code, String codeNum) {
        return receiptMapper.findByCodeAndCodeNum(code,codeNum);
    }

    @Override
    public void add(Receipt receipt) {
        receiptMapper.insert(receipt);
    }

    @Override
    public List<Receipt> findByPhoneNum(String phoneNum, List<Integer> endActivityIds, Integer lastId, int pageSize) {
        return receiptMapper.findByPhoneNum(phoneNum,endActivityIds,lastId,pageSize);
    }
}
